3.7.40 \(\int \frac {(A+B \cos (e+f x)) (c \sec (e+f x))^m}{a+b \cos (e+f x)} \, dx\) [640]

Optimal. Leaf size=299 \[ -\frac {(A b-a B) F_1\left (\frac {1}{2};\frac {m}{2},1;\frac {3}{2};\sin ^2(e+f x),-\frac {b^2 \sin ^2(e+f x)}{a^2-b^2}\right ) \cos (e+f x) \cos ^2(e+f x)^{m/2} (c \sec (e+f x))^{1+m} \sin (e+f x)}{\left (a^2-b^2\right ) c f}+\frac {a (A b-a B) F_1\left (\frac {1}{2};\frac {1+m}{2},1;\frac {3}{2};\sin ^2(e+f x),-\frac {b^2 \sin ^2(e+f x)}{a^2-b^2}\right ) \cos ^2(e+f x)^{\frac {1+m}{2}} (c \sec (e+f x))^{1+m} \sin (e+f x)}{b \left (a^2-b^2\right ) c f}-\frac {B c \, _2F_1\left (\frac {1}{2},\frac {1-m}{2};\frac {3-m}{2};\cos ^2(e+f x)\right ) (c \sec (e+f x))^{-1+m} \sin (e+f x)}{b f (1-m) \sqrt {\sin ^2(e+f x)}} \]

[Out]

-(A*b-B*a)*AppellF1(1/2,1/2*m,1,3/2,sin(f*x+e)^2,-b^2*sin(f*x+e)^2/(a^2-b^2))*cos(f*x+e)*(cos(f*x+e)^2)^(1/2*m
)*(c*sec(f*x+e))^(1+m)*sin(f*x+e)/(a^2-b^2)/c/f+a*(A*b-B*a)*AppellF1(1/2,1/2+1/2*m,1,3/2,sin(f*x+e)^2,-b^2*sin
(f*x+e)^2/(a^2-b^2))*(cos(f*x+e)^2)^(1/2+1/2*m)*(c*sec(f*x+e))^(1+m)*sin(f*x+e)/b/(a^2-b^2)/c/f-B*c*hypergeom(
[1/2, 1/2-1/2*m],[3/2-1/2*m],cos(f*x+e)^2)*(c*sec(f*x+e))^(-1+m)*sin(f*x+e)/b/f/(1-m)/(sin(f*x+e)^2)^(1/2)

________________________________________________________________________________________

Rubi [A]
time = 0.37, antiderivative size = 299, normalized size of antiderivative = 1.00, number of steps used = 10, number of rules used = 8, integrand size = 33, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.242, Rules used = {3039, 4123, 3857, 2722, 3954, 2902, 3268, 440} \begin {gather*} -\frac {(A b-a B) \sin (e+f x) \cos (e+f x) \cos ^2(e+f x)^{m/2} (c \sec (e+f x))^{m+1} F_1\left (\frac {1}{2};\frac {m}{2},1;\frac {3}{2};\sin ^2(e+f x),-\frac {b^2 \sin ^2(e+f x)}{a^2-b^2}\right )}{c f \left (a^2-b^2\right )}+\frac {a (A b-a B) \sin (e+f x) \cos ^2(e+f x)^{\frac {m+1}{2}} (c \sec (e+f x))^{m+1} F_1\left (\frac {1}{2};\frac {m+1}{2},1;\frac {3}{2};\sin ^2(e+f x),-\frac {b^2 \sin ^2(e+f x)}{a^2-b^2}\right )}{b c f \left (a^2-b^2\right )}-\frac {B c \sin (e+f x) (c \sec (e+f x))^{m-1} \, _2F_1\left (\frac {1}{2},\frac {1-m}{2};\frac {3-m}{2};\cos ^2(e+f x)\right )}{b f (1-m) \sqrt {\sin ^2(e+f x)}} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[((A + B*Cos[e + f*x])*(c*Sec[e + f*x])^m)/(a + b*Cos[e + f*x]),x]

[Out]

-(((A*b - a*B)*AppellF1[1/2, m/2, 1, 3/2, Sin[e + f*x]^2, -((b^2*Sin[e + f*x]^2)/(a^2 - b^2))]*Cos[e + f*x]*(C
os[e + f*x]^2)^(m/2)*(c*Sec[e + f*x])^(1 + m)*Sin[e + f*x])/((a^2 - b^2)*c*f)) + (a*(A*b - a*B)*AppellF1[1/2,
(1 + m)/2, 1, 3/2, Sin[e + f*x]^2, -((b^2*Sin[e + f*x]^2)/(a^2 - b^2))]*(Cos[e + f*x]^2)^((1 + m)/2)*(c*Sec[e
+ f*x])^(1 + m)*Sin[e + f*x])/(b*(a^2 - b^2)*c*f) - (B*c*Hypergeometric2F1[1/2, (1 - m)/2, (3 - m)/2, Cos[e +
f*x]^2]*(c*Sec[e + f*x])^(-1 + m)*Sin[e + f*x])/(b*f*(1 - m)*Sqrt[Sin[e + f*x]^2])

Rule 440

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_))^(q_), x_Symbol] :> Simp[a^p*c^q*x*AppellF1[1/n, -p,
 -q, 1 + 1/n, (-b)*(x^n/a), (-d)*(x^n/c)], x] /; FreeQ[{a, b, c, d, n, p, q}, x] && NeQ[b*c - a*d, 0] && NeQ[n
, -1] && (IntegerQ[p] || GtQ[a, 0]) && (IntegerQ[q] || GtQ[c, 0])

Rule 2722

Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[Cos[c + d*x]*((b*Sin[c + d*x])^(n + 1)/(b*d*(n + 1
)*Sqrt[Cos[c + d*x]^2]))*Hypergeometric2F1[1/2, (n + 1)/2, (n + 3)/2, Sin[c + d*x]^2], x] /; FreeQ[{b, c, d, n
}, x] &&  !IntegerQ[2*n]

Rule 2902

Int[((d_.)*sin[(e_.) + (f_.)*(x_)])^(n_.)/((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Dist[a, Int[(d*
Sin[e + f*x])^n/(a^2 - b^2*Sin[e + f*x]^2), x], x] - Dist[b/d, Int[(d*Sin[e + f*x])^(n + 1)/(a^2 - b^2*Sin[e +
 f*x]^2), x], x] /; FreeQ[{a, b, d, e, f, n}, x] && NeQ[a^2 - b^2, 0]

Rule 3039

Int[(csc[(e_.) + (f_.)*(x_)]*(g_.))^(p_.)*((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((c_) + (d_.)*sin[(e_.
) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[g^(m + n), Int[(g*Csc[e + f*x])^(p - m - n)*(b + a*Csc[e + f*x])^m*(
d + c*Csc[e + f*x])^n, x], x] /; FreeQ[{a, b, c, d, e, f, g, p}, x] && NeQ[b*c - a*d, 0] &&  !IntegerQ[p] && I
ntegerQ[m] && IntegerQ[n]

Rule 3268

Int[((d_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]^2)^(p_.), x_Symbol] :> With[{ff
 = FreeFactors[Cos[e + f*x], x]}, Dist[(-ff)*d^(2*IntPart[(m - 1)/2] + 1)*((d*Sin[e + f*x])^(2*FracPart[(m - 1
)/2])/(f*(Sin[e + f*x]^2)^FracPart[(m - 1)/2])), Subst[Int[(1 - ff^2*x^2)^((m - 1)/2)*(a + b - b*ff^2*x^2)^p,
x], x, Cos[e + f*x]/ff], x]] /; FreeQ[{a, b, d, e, f, m, p}, x] &&  !IntegerQ[m]

Rule 3857

Int[(csc[(c_.) + (d_.)*(x_)]*(b_.))^(n_), x_Symbol] :> Simp[(b*Csc[c + d*x])^(n - 1)*((Sin[c + d*x]/b)^(n - 1)
*Int[1/(Sin[c + d*x]/b)^n, x]), x] /; FreeQ[{b, c, d, n}, x] &&  !IntegerQ[n]

Rule 3954

Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_.)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_.), x_Symbol] :> Dist[Sin[
e + f*x]^n*(d*Csc[e + f*x])^n, Int[(b + a*Sin[e + f*x])^m/Sin[e + f*x]^(m + n), x], x] /; FreeQ[{a, b, d, e, f
, n}, x] && NeQ[a^2 - b^2, 0] && IntegerQ[m]

Rule 4123

Int[((csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_)*(csc[(e_.) + (f_.)*(x_)]*(B_.) + (A_)))/(csc[(e_.) + (f_.)*(x_)]*(b_
.) + (a_)), x_Symbol] :> Dist[A/a, Int[(d*Csc[e + f*x])^n, x], x] - Dist[(A*b - a*B)/(a*d), Int[(d*Csc[e + f*x
])^(n + 1)/(a + b*Csc[e + f*x]), x], x] /; FreeQ[{a, b, d, e, f, A, B, n}, x] && NeQ[A*b - a*B, 0] && NeQ[a^2
- b^2, 0]

Rubi steps

\begin {align*} \int \frac {(A+B \cos (e+f x)) (c \sec (e+f x))^m}{a+b \cos (e+f x)} \, dx &=\int \frac {(c \sec (e+f x))^m (B+A \sec (e+f x))}{b+a \sec (e+f x)} \, dx\\ &=\frac {B \int (c \sec (e+f x))^m \, dx}{b}+\frac {(A b-a B) \int \frac {(c \sec (e+f x))^{1+m}}{b+a \sec (e+f x)} \, dx}{b c}\\ &=\frac {\left (B \left (\frac {\cos (e+f x)}{c}\right )^m (c \sec (e+f x))^m\right ) \int \left (\frac {\cos (e+f x)}{c}\right )^{-m} \, dx}{b}+\frac {\left ((A b-a B) \cos ^{1+m}(e+f x) (c \sec (e+f x))^{1+m}\right ) \int \frac {\cos ^{-m}(e+f x)}{a+b \cos (e+f x)} \, dx}{b c}\\ &=-\frac {B \cos (e+f x) \, _2F_1\left (\frac {1}{2},\frac {1-m}{2};\frac {3-m}{2};\cos ^2(e+f x)\right ) (c \sec (e+f x))^m \sin (e+f x)}{b f (1-m) \sqrt {\sin ^2(e+f x)}}-\frac {\left ((A b-a B) \cos ^{1+m}(e+f x) (c \sec (e+f x))^{1+m}\right ) \int \frac {\cos ^{1-m}(e+f x)}{a^2-b^2 \cos ^2(e+f x)} \, dx}{c}+\frac {\left (a (A b-a B) \cos ^{1+m}(e+f x) (c \sec (e+f x))^{1+m}\right ) \int \frac {\cos ^{-m}(e+f x)}{a^2-b^2 \cos ^2(e+f x)} \, dx}{b c}\\ &=-\frac {B \cos (e+f x) \, _2F_1\left (\frac {1}{2},\frac {1-m}{2};\frac {3-m}{2};\cos ^2(e+f x)\right ) (c \sec (e+f x))^m \sin (e+f x)}{b f (1-m) \sqrt {\sin ^2(e+f x)}}+\frac {\left (a (A b-a B) \cos ^{1+2 \left (-\frac {1}{2}-\frac {m}{2}\right )+m}(e+f x) \cos ^2(e+f x)^{\frac {1}{2}+\frac {m}{2}} (c \sec (e+f x))^{1+m}\right ) \text {Subst}\left (\int \frac {\left (1-x^2\right )^{\frac {1}{2} (-1-m)}}{a^2-b^2+b^2 x^2} \, dx,x,\sin (e+f x)\right )}{b c f}-\frac {\left ((A b-a B) \cos (e+f x) \cos ^2(e+f x)^{m/2} (c \sec (e+f x))^{1+m}\right ) \text {Subst}\left (\int \frac {\left (1-x^2\right )^{-m/2}}{a^2-b^2+b^2 x^2} \, dx,x,\sin (e+f x)\right )}{c f}\\ &=-\frac {(A b-a B) F_1\left (\frac {1}{2};\frac {m}{2},1;\frac {3}{2};\sin ^2(e+f x),-\frac {b^2 \sin ^2(e+f x)}{a^2-b^2}\right ) \cos (e+f x) \cos ^2(e+f x)^{m/2} (c \sec (e+f x))^{1+m} \sin (e+f x)}{\left (a^2-b^2\right ) c f}+\frac {a (A b-a B) F_1\left (\frac {1}{2};\frac {1+m}{2},1;\frac {3}{2};\sin ^2(e+f x),-\frac {b^2 \sin ^2(e+f x)}{a^2-b^2}\right ) \cos ^2(e+f x)^{\frac {1+m}{2}} (c \sec (e+f x))^{1+m} \sin (e+f x)}{b \left (a^2-b^2\right ) c f}-\frac {B \cos (e+f x) \, _2F_1\left (\frac {1}{2},\frac {1-m}{2};\frac {3-m}{2};\cos ^2(e+f x)\right ) (c \sec (e+f x))^m \sin (e+f x)}{b f (1-m) \sqrt {\sin ^2(e+f x)}}\\ \end {align*}

________________________________________________________________________________________

Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(10630\) vs. \(2(299)=598\).
time = 26.34, size = 10630, normalized size = 35.55 \begin {gather*} \text {Result too large to show} \end {gather*}

Warning: Unable to verify antiderivative.

[In]

Integrate[((A + B*Cos[e + f*x])*(c*Sec[e + f*x])^m)/(a + b*Cos[e + f*x]),x]

[Out]

Result too large to show

________________________________________________________________________________________

Maple [F]
time = 0.40, size = 0, normalized size = 0.00 \[\int \frac {\left (A +B \cos \left (f x +e \right )\right ) \left (c \sec \left (f x +e \right )\right )^{m}}{a +b \cos \left (f x +e \right )}\, dx\]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((A+B*cos(f*x+e))*(c*sec(f*x+e))^m/(a+b*cos(f*x+e)),x)

[Out]

int((A+B*cos(f*x+e))*(c*sec(f*x+e))^m/(a+b*cos(f*x+e)),x)

________________________________________________________________________________________

Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*cos(f*x+e))*(c*sec(f*x+e))^m/(a+b*cos(f*x+e)),x, algorithm="maxima")

[Out]

integrate((B*cos(f*x + e) + A)*(c*sec(f*x + e))^m/(b*cos(f*x + e) + a), x)

________________________________________________________________________________________

Fricas [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*cos(f*x+e))*(c*sec(f*x+e))^m/(a+b*cos(f*x+e)),x, algorithm="fricas")

[Out]

integral((B*cos(f*x + e) + A)*(c*sec(f*x + e))^m/(b*cos(f*x + e) + a), x)

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\left (c \sec {\left (e + f x \right )}\right )^{m} \left (A + B \cos {\left (e + f x \right )}\right )}{a + b \cos {\left (e + f x \right )}}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*cos(f*x+e))*(c*sec(f*x+e))**m/(a+b*cos(f*x+e)),x)

[Out]

Integral((c*sec(e + f*x))**m*(A + B*cos(e + f*x))/(a + b*cos(e + f*x)), x)

________________________________________________________________________________________

Giac [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: TypeError} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*cos(f*x+e))*(c*sec(f*x+e))^m/(a+b*cos(f*x+e)),x, algorithm="giac")

[Out]

Exception raised: TypeError >> An error occurred running a Giac command:INPUT:sage2:=int(sage0,sageVARx):;OUTP
UT:Unable to divide, perhaps due to rounding error%%%{-1,[0,1,0,0]%%%} / %%%{1,[0,0,1,0]%%%}+%%%{-1,[0,0,0,1]%
%%} Error:

________________________________________________________________________________________

Mupad [F]
time = 0.00, size = -1, normalized size = -0.00 \begin {gather*} \int \frac {{\left (\frac {c}{\cos \left (e+f\,x\right )}\right )}^m\,\left (A+B\,\cos \left (e+f\,x\right )\right )}{a+b\,\cos \left (e+f\,x\right )} \,d x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(((c/cos(e + f*x))^m*(A + B*cos(e + f*x)))/(a + b*cos(e + f*x)),x)

[Out]

int(((c/cos(e + f*x))^m*(A + B*cos(e + f*x)))/(a + b*cos(e + f*x)), x)

________________________________________________________________________________________